﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MGroup.aspx.cs" Inherits="Jy123.Web.Manage.MGroup1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.js" type="text/javascript"></script>

    <script src="js/jquery.ui.js" type="text/javascript"></script>

    <script src="js/main.js" type="text/javascript"></script>

    <script language="javascript" type="text/jscript"> 
        $(function() {
        	$('#Group').dialog({
				autoOpen: false,
				width: '300px',
				modal: true
				}),
			$('#txtGroupName').keyup(function(){
			    if(this.value=='')
			        $("#btnAddGrup").attr({ disabled: true });
			    else
			        $("#btnAddGrup").attr({ disabled: false });
			})
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <h4>
        <a href="#"><span>页面分类管理</span></a></h4>
    <div class="register">
        <h5>
            分组名称</h5>
        <ul>
            <li>
                <input id="txtGroupName" type="text" class="text" runat="server" /></li>
            <li><span class="warning" id="warerrgroup" style="display: none">请输入分组名称</span></li>
        </ul>
        <ul class="bb">
            <li>
                <asp:Button ID="btnAddGrup" runat="server" CssClass="button" Text="添加分组" Enabled="false" onclick="btnAddGrup_Click"/>
            </li>
        </ul>
        <asp:GridView ID="GridView1" runat="server" CssClass="tblist" AutoGenerateColumns="False"
            DataKeyNames="ID" DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
            <Columns>
                <asp:BoundField DataField="PName" HeaderText="分组名称" SortExpression="PName" />
                <asp:TemplateField HeaderText="操作" ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="编辑"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="删除" ForeColor="#CB6E50"></asp:LinkButton>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="更新"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="取消" ForeColor="#CB6E50"></asp:LinkButton>
                </EditItemTemplate>
                <ControlStyle CssClass="btnsty" />
            </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        DeleteCommand="DELETE FROM [Manage_Page] WHERE [ID] = @ID" 
        SelectCommand="SELECT [ID], [PName] FROM [Manage_Page] WHERE UpID=0 and ID<>1"
        UpdateCommand="UPDATE [Manage_Page] SET [PName] = @PName WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="PName" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <% =Message %>
    </form>
</body>
</html>